package com.cby.leetcode.二叉树.LC94;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName: LC94
 * Package: com.cby.leetcode.二叉树.LC94.LC94
 * Description:
 *
 * @Author dhu-bion
 * @Create 2025/9/4 15:15
 * @Version 1.0
 */
public class LC94 {

    public class TreeNode {

        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }

    }

    class Solution{
        public List<Integer> inorderTraversal(TreeNode root) {
            List<Integer> res = new ArrayList<>();
            inorder(root,res);

            return res;
        }

        public void inorder(TreeNode root,List<Integer> list){
            inorder(root.left,list);
            list.add(root.val);
            inorder(root.right,list);
        }


    }

}
